/*
 * Copyright 2008-2023 dexian.vip. All rights reserved.
 * Support: http://www.dexian.vip
 * License: http://www.dexian.vip/license
 */

package vip.dexian.admin.assembler;

import vip.dexian.admin.dto.OperateLogDTO;
import vip.dexian.admin.entity.OperateLog;
import vip.dexian.core.base.mapstruct.BaseEntityToDTOAssembler;
import org.mapstruct.Builder;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

/**
 * 操作日志DTO映射
 *
 * @author 挺好的 2023年06月07日 11:32:34
 */
@Mapper (componentModel = "spring", builder = @Builder (disableBuilder = true))
public abstract class OperateLogDTOAssembler extends BaseEntityToDTOAssembler <OperateLog, OperateLogDTO, Long> {

    /**
     * entity -> DTO
     *
     * @param entity
     *         待转换的实体类
     *
     * @return DTO
     */
    @Override
    @Mapping (target = "ip", expression = "java(vip.dexian.common.utils.IpToLongUtils.toIp(entity.getIp()))")
    public abstract OperateLogDTO toDTO (OperateLog entity);
}